<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    html,
    body{
      margin: 0;
      padding: 0;
      height: 100%;
      background-image: linear-gradient(to bottom right,red,gold);
    }
    .box{
      width: 400px;
      height: 250px;
      background-color: rgba(255,255,255,0.6);
      border-radius: 6px;
      position: absolute;
      left: 50%;
      top: 40%;
      transform: translate(-50%,-50%);
      box-shadow: 1px 1px 10px #fff;
      text-shadow: 0 1px 30px white;

      display: flex;
      justify-content: space-around;
      align-items: center;
      font-size: 70px;
      user-select: none;
      padding: 0 20px;

      /* 盒子阴影 */
      -webkit-box-reflect: below 0px -webkit-gradient(linear,left top,left bottom,from(transparent),color-stop(0%,transparent),to(rgba(255,255,255,0.2)));
    }
  </style>
</head>
<body>
  <div class="box">
    <div id="HH">00</div>
    <div>:</div>
    <div id="mm">00</div>
    <div>:</div>
    <div id="ss">00</div>
  </div>

  <script>
    function formatDate(date){
      // if(date<10){
      //   return '0' + date
      // }
      // return date
      return date<10 ? '0' + date : date
    }
    window.onload = function(){
      setInterval(()=>{
        var dt = new Date()
        var HH = formatDate(dt.getHours())
        var mm = formatDate(dt.getMinutes()) 
        var ss = formatDate(dt.getSeconds())
        // 为页面赋值
        document.getElementById('HH').innerText = HH;
        document.getElementById('mm').innerText = mm
        document.getElementById('ss').innerText = ss
      })
    }
  </script>
</body>
</html>